-
Notifications
You must be signed in to change notification settings - Fork 738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL][NFC] Refactor #include
s
#16030
base: sycl
Are you sure you want to change the base?
[SYCL][NFC] Refactor #include
s
#16030
Conversation
This patch is a collection of various cleanups made in public headers: - Cleaned up many unnecessary includes. It doesn't change total amount of header files we use in total by `sycl.hpp`, but makes our code cleaner - Made it so there are no headers depending on `backend.hpp` and it is only included by `sycl.hpp`, so that we can make it an opt-in header - Removed `types.hpp` in favor of direct use of `vector.hpp` - Added missing includes and forward-declarations to places where we relied on implicit includes - Moved certain helper function declarations/definitions to better places (common utils to utils headers, library-only declarations to library headers, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make the patch ready for review, even though CI fails: by some reason checkout step started to consistently fail for my PR - I will try to figure that our while I'm waiting for feedback and applying it.
@@ -15,7 +15,6 @@ set(SYCL_THREADS_LIB ${CMAKE_THREAD_LIBS_INIT}) | |||
|
|||
# TEST_INCLUDE_PATH is used for syntax-only verification of type information. | |||
list(APPEND test_includes ${SYCL_INCLUDE}) | |||
list(APPEND test_includes ${SYCL_INCLUDE}/sycl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers: without this change test/gdb/printer.cpp
failed to compile. The reason for that is because in program_impl.hpp
we have #include <detail/ur.hpp>
line.
We have two detail/ur.hpp
headers: one under sycl/include/sycl
and another under sycl/source
. During the RT build we only have sycl/include
and sycl/source
include paths, so we take the right header and everything works fine.
However, for this specific test we add an extra include path, which makes a wrong file to be included and leads to missing declaration of convertUrBackend
(which is moved into the library by this PR). I do not see any failures which would be caused by this particular change and I also don't quite understand why do we need this path at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@intel/llvm-reviewers-cuda, @intel/dpcpp-nativecpu-pi-reviewers, could you please take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like nice cleanup. Small nits to think about, but generally LGTM
@@ -51,7 +51,8 @@ | |||
|
|||
namespace sycl { | |||
|
|||
// TODO: Fix in the next ABI breaking windows. | |||
// TODO: It should be within _V1 namespace, fix in the next ABI breaking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a ticket for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I've submitted #16086
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how useful it would be. What I did for the last major breaking release is simply grep for abi
and fix the code.
@@ -35,6 +34,7 @@ | |||
|
|||
namespace sycl { | |||
inline namespace _V1 { | |||
enum class backend : char; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forward declarations of enums classes make me slightly uneasy since the storage types can end up mismatching (which can't happen with a struct forward declaration for example). I've had to track down nasty bugs due to this in the past.
Do we have a way to ensure that if the complete declaration changes type, we know to update all of these forward decls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a way to ensure that if the complete declaration changes type, we know to update all of these forward decls?
I actually had to type the exact type here, or otherwise compiler complained that forward declaration doesn't match the actual definition. From that point of view, I think it should be safe for us to say that such mechanism exists.
Note that I was using clang
as compiler and it could have been a diagnostic specific to it
This patch is a collection of various cleanups made in public headers:
sycl.hpp
, but makes our code cleanerbackend/%backend_name%.hpp
) depend onbackend.hpp
and it is (almost) only included bysycl.hpp
, so that we can make it an opt-in headertypes.hpp
in favor of direct use ofvector.hpp